<div class="content">
	<div class="title">
	<h2>答疑系统</h2>
	</div>
	<div class="answersystemblock">
		<div class="studentquery">
		<form action="<?php echo $this->baseUrl().'/answersystem/index';?>" method="post">
		课程名称：<input type="text" id="class" name="class"/>
		学院：<select name="college">
     	 <?php
     	 	foreach ($this->collegearray as $key=>$value)
     	 	{
     	 	    echo '<option value='.$key.'>'.$value.'</option>';
     	 	} 
     	 ?>
     	 </select>
		教师名：<input type="text" id="teachername" name="teachername"/>
		<button type="submit">查看</button>
    	</form>
		</div>
		<form action="<?php echo $this->baseUrl().'/answersystem/studentdetail'?>" method="post">
		<p id="squery" name="squery">在下表中登记 <button type="submit">提交登记</button></p>
		<div class="weekdays">
		<?php 
			date_default_timezone_set('Asia/Shanghai');
			$weekdayarray = array('周日','周一','周二','周三','周四','周五','周六');
			for($i = 0;$i<7;$i++)
			    echo '<h4>'.$weekdayarray[$i].'<p>'.gmdate('Y/m/d',strtotime($this->daybegin.'-0:0') + $i*24*3600).'</p></h4>'; 
		?>
		
		</div>
		<div class="classtime">
		<h4>第一大节</h4><h4>第二大节</h4><h4>第三大节</h4><h4>第四大节</h4><h4>第五大节</h4>
		</div>
		<div class="table">
			<!-- 
			<div class="grid1"><p align="center" id="p1">计算机学院</p><p align="center" id="p2">冯伟森(25)</p><p align="center" id="p3">离散数学</p><p id="sregister" name="sregister">登记<input type="checkbox"/></p></div><div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div>
			<div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div>
			<div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div>
			<div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div>
			<div class="grid"></div><div class="grid2"><p align="center" id="p1">计算机学院</p><p align="center" id="p2">冯伟森(25)</p><p align="center" id="p3">离散数学</p></div><div class="grid1"><p align="center" id="p1">计算机学院</p><p align="center" id="p2">冯伟森(25)</p><p align="center" id="p3">离散数学</p><p id="sregister" name="sregister">登记<input type="checkbox"/></p></div><div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div>
			
			 -->
			 
			 <?php
			 	    $classtime = $this->classtime;
			 	    date_default_timezone_set('Asia/Shanghai');
			 	    $daybegin = $this->daybegin;
			 	    for($class=0;$class<5;$class++)//注意是从周日开始的
			 	    { 
			 	        for($weekday=0;$weekday<7;$weekday++)
			 	        {
			 	            $time = $daybegin.'-'.$classtime[$class];
			 	            $timecmp = strtotime($time)+$weekday*24*3600;
			 	            if($timecmp<=time()+8*3600)
			 	            {
			 	                echo '<div class="grid">';
			 	                echo '</div>';
			 	                //echo gmdate('Y-m-d H:i:s',$timecmp).'</br>'.gmdate('Y-m-d H:i:s',time()+8*3600).'</div>';
			 	                
			 	            }
			 	            else 
			 	            {
			 	                $find = false;
			 	                if(isset($this->allapp))
			 	                {
			 	                    foreach($this->allapp as $key => $app)			 	         
			 	                	{
			 	                    	if($app['date']==$timecmp)
			 	                    	{
			 	                    	    $findindex = $key;
			 	                    	    $find = true;
			 	                    	    break;
			 	                    	}
			 	                	}
			 	                }
			 	                if(!$find)echo '<div class="grid"></div>';
			 	                else 
			 	                {
									if($this->allapp[$findindex]['status']==2)
									{
									    //
									    //echo '<div class="grid1"><p align="center" id="p1">'.$this->collegearray[$this->allapp[$findindex]['college']].'</p><p align="center" id="p2">'.$this->allapp[$findindex]['teacher'].'('.$this->allapp[$findindex]['countstudent'].')</p><p align="center" id="p3">'.$this->allapp[$findindex]['class'].'</p><a href="'.$this->baseUrl().'/answersystem/teachercancel?id='.$this->allapp[$findindex]['id'].'">[取消]</a><a href="'.$this->baseUrl().'/answersystem/teachersure?id='.$this->allapp[$findindex]['id'].'">[决定]</a></div>';
									     echo '<div class="grid1"><p align="center" id="p1">'.$this->collegearray[$this->allapp[$findindex]['college']].'</p><p align="center" id="p2">'.$this->allapp[$findindex]['teacher'].'('.$this->allapp[$findindex]['countstudent'].')</p><p align="center" id="p3">'.$this->allapp[$findindex]['class'].'</p>';
									     $id = $this->allapp[$findindex]['id'];
									     if(isset($this->hasregist["$id"])&&$this->hasregist["$id"]==true)
									     	echo '<a>&nbsp[您已登记]</a>';
									     else echo '<p id="sregister" name="sregister">登记<input type="checkbox" id="'.$this->allapp[$findindex]['id'].'" name="'.$this->allapp[$findindex]['id'].'"/>';
									     echo '</p></div>';			 	                    
									}
									else if($this->allapp[$findindex]['status']==3)
									{
									    //echo '<div class="grid2"><p align="center" id="p1">'.$this->collegearray[$this->allapp[$findindex]['college']].'</p><p align="center" id="p2">'.$this->allapp[$findindex]['teacher'].'('.$this->allapp[$findindex]['countstudent'].')</p><p align="center" id="p3">'.$this->allapp[$findindex]['class'].'</p><a>[已定]</a><a href="'.$this->baseUrl().'/answersystem/teachercancel?id='.$this->allapp[$findindex]['id'].'">[取消]</a></div>';
										echo '<div class="grid2"><p align="center" id="p1">'.$this->collegearray[$this->allapp[$findindex]['college']].'</p><p align="center" id="p2">'.$this->allapp[$findindex]['teacher'].'('.$this->allapp[$findindex]['countstudent'].')</p><p align="center" id="p3">'.$this->allapp[$findindex]['class'].'</p><a>&nbsp&nbsp&nbsp[已定]</a></div>';
									}
									else echo '<div class="grid"></div>';
			 	                }
			 	            }
			 	            //echo $timecmp.'</br>';
									 	        
			 	        }
			 	        
			 	    }
			 	    //print_r($class);
			 	    //echo gmdate('Y-m-d H:i:s',1344470400 + 3600*8).'</br>';
			 	    //echo gmdate('Y-m-d H:i:s',1344398460 + 3600*8);
			 	    //echo strtotime('2012/8/1-'.$classtime[0]);
			 	    //echo gmdate('Y-m-d H:i:s',strtotime('2012/8/1-'.$classtime[0]));
			 ?>
		</div>
		</form>
	</div>
</div>	